Skip to content

Sqlite connections dont ignore the schema property on entities #4598

@roman-acumen

Description

@roman-acumen

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[x] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

The Entity schema property is not ignored by databases that don't need it

Steps to reproduce or a small repository showing the problem:

@Entity("test", { schema: "test" })
export class Test {
	@PrimaryColumn()
	public id: number;

	@Column()
	public test: string;
}

For postgres all will work ok, both syncronize and find will work ok:

const connection = await typeorm.createConnection({
			type: "postgres",
			url: databaseConnectionUrl,
			entities: [Test]
		});
await connection.synchronize(true);
const res = await connection.getRepository(Test).save(new Test(42, "Meaning of life"));
const res2 = await connection.getRepository(Test).findOrFail({id: 42});

The same code on sqlite will pass the creation, but will fail on working

const connection = await typeorm.createConnection({
			type: "sqlite",
			database: ":memory:",
			entities: [Test]
		});
await connection.synchronize(true);
// This will pass and all tables will be created
const res = await connection.getRepository(Test).save(new Test(42, "Meaning of life"));
// This will fail saying table test.test doesn't exist
const res2 = await connection.getRepository(Test).findOrFail({id: 42});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions