0
I’m having a problem where I’m not being able to create more than one table in the fluuter sqlite. When trying to create a table if the database has already been created generates the error no such table
I’m creating it this way:
static Future<Database> database() async {
final dbPath = await getDatabasesPath();
final sql = '''CREATE TABLE cartoes(
id INTEGER,
instituiBanc int NOT NULL,
bandeira int NOT NULL,
isDebito INTEGER,
vencimento TEXT,
saldoDisponivel REAL,
limite REAL,
PRIMARY KEY("id" AUTOINCREMENT)
)''';
return openDatabase(
path.join(dbPath, 'table.db'),
onCreate: (db, version) {
return db.execute(sql);
},
version: 1,
);
}
static Future<Database> database() async {
final dbPath = await getDatabasesPath();
final sql = '''CREATE TABLE categoria(
id INTEGER,
descricao TEXT NOT NULL,
isReceita INTEGER ,
PRIMARY KEY("id" AUTOINCREMENT)
)''';
return openDatabase(
path.join(dbPath, 'table.db'),
onCreate: (db, version) {
return db.execute(sql);
},
version: 1,
);
}
If it enters the bank and enters the same already created, it should not create only the missing table?