Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple requests of creating/updading database/table #292

Open
priyankmodi3 opened this issue Feb 23, 2023 · 0 comments
Open

Multiple requests of creating/updading database/table #292

priyankmodi3 opened this issue Feb 23, 2023 · 0 comments

Comments

@priyankmodi3
Copy link

Error Stack:
Restarted application in 2,414ms.
I/flutter (10267): init() -> tableName:category
I/flutter (10267): init() -> tableName:profile
I/flutter (10267): Inside init state
I/flutter (10267): SQFENTITIY: Table named [category] was initialized successfully (No added new columns)
I/flutter (10267): SQFENTITIY: Table named [category] was initialized successfully (No added new columns)
I/flutter (10267): SQFENTITIY: Table named [profile] was initialized successfully (No added new columns)
I/flutter (10267): SQFENTITIY: The database is ready for use
I/flutter (10267): SQFENTITIY: Table named [profile] was initialized successfully (No added new columns)
I/flutter (10267): SQFENTITIY: The database is ready for use

On hard loading the application or running first time, it tries to create database/table multiple times. Below is my modal.dart file code


import 'package:sqfentity_gen/sqfentity_gen.dart';

part 'database_modal.g.dart';

const SqfEntityTable tableCategory = SqfEntityTable(
    tableName: 'category',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    useSoftDeleting: true,
    modelName: null,
    fields: [
      SqfEntityField('name', DbType.text),
    ]);

const SqfEntityTable tableProfile = SqfEntityTable(
    tableName: 'profile',
    primaryKeyName: 'id',
    primaryKeyType: PrimaryKeyType.integer_auto_incremental,
    useSoftDeleting: true,
    modelName: null,
    fields: [
      SqfEntityField('name', DbType.text)
    ]);

const SqfEntitySequence seqIdentity = SqfEntitySequence(
  sequenceName: 'identity',
  // maxValue: 10000, /* optional. default is max int (9.223.372.036.854.775.807) */
  //modelName: 'SQEidentity',
  /* optional. SqfEntity will set it to sequenceName automatically when the modelName is null*/
  //cycle : false,    /* optional. default is false; */
  //minValue = 0;     /* optional. default is 0 */
  //incrementBy = 1;  /* optional. default is 1 */
  // startWith = 0;   /* optional. default is 0 */
);

@SqfEntityBuilder(myDbModel)
const SqfEntityModel myDbModel = SqfEntityModel(
    modelName: 'MyAppDatabaseModel',
    databaseName: 'doc_vault_with_orm2.db',
    sequences: [seqIdentity],
    databaseTables: [tableCategory, tableProfile],
    // formTables: [tableCategory],
    // put defined sequences into the sequences list.
    // bundledDatabasePath: null // 'assets/sample.db' // This value is optional. When bundledDatabasePath is empty then EntityBase creats a new database when initializing the database
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant