I see index is support in readme.md, is there example for it?
is the issue actual?
is the issue actual?
It's worked. but if I created index before
sqlite_orm::make_storage(dbName,
sqlite_orm::make_index("ids_first_name", &User::getFirstName),
sqlite_orm::make_table("users",
sqlite_orm::make_column("id", &User::setId, &User::getId, sqlite_orm::autoincrement(), sqlite_orm::primary_key()),
sqlite_orm::make_column("first_name", &User::setFirstName, &User::getFirstName),
sqlite_orm::make_column("last_name", &User::setLastName, &User::getLastName)));
Then I recreate table without index
sqlite_orm::make_storage(dbName,
sqlite_orm::make_table("users",
sqlite_orm::make_column("id", &User::setId, &User::getId, sqlite_orm::autoincrement(), sqlite_orm::primary_key()),
sqlite_orm::make_column("first_name", &User::setFirstName, &User::getFirstName),
sqlite_orm::make_column("last_name", &User::setLastName, &User::getLastName)));
Now I see the table by sqlite3 shell, the index is still existed.
CREATE TABLE 'users' ( 'id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , 'first_name' TEXT NOT NULL , 'last_name' TEXT NOT NULL );
CREATE INDEX 'ids_first_name' ON 'users' ( 'first_name' ) ;
Order matters cause when index is being created the table must exist. Is the issue actual?
It's works. Thank you.