Home / Function/ migrate1() — drizzle-orm Function Reference

migrate1() — drizzle-orm Function Reference

Architecture documentation for the migrate1() function in index.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  3d8eadef_04a9_b2ef_ce18_efa73bed54c9["migrate1()"]
  34f01008_7c45_3804_1fad_b8b59cd8a413["MyDurableObject"]
  3d8eadef_04a9_b2ef_ce18_efa73bed54c9 -->|defined in| 34f01008_7c45_3804_1fad_b8b59cd8a413
  7c7acbfe_6328_c8df_feba_552ee62a84d9["default.fetch()"]
  7c7acbfe_6328_c8df_feba_552ee62a84d9 -->|calls| 3d8eadef_04a9_b2ef_ce18_efa73bed54c9
  style 3d8eadef_04a9_b2ef_ce18_efa73bed54c9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

integration-tests/tests/sqlite/durable-objects/index.ts lines 203–226

	async migrate1(): Promise<void> {
		try {
			this.db.run(sql`drop table if exists another_users`);
			this.db.run(sql`drop table if exists users12`);
			this.db.run(sql`drop table if exists __drizzle_migrations`);

			migrate(this.db, migrations);

			this.db.insert(usersMigratorTable).values({ name: 'John', email: 'email' }).run();
			const result = this.db.select().from(usersMigratorTable).all();

			this.db.insert(anotherUsersMigratorTable).values({ name: 'John', email: 'email' }).run();
			const result2 = this.db.select().from(anotherUsersMigratorTable).all();

			expect(result).deep.equal([{ id: 1, name: 'John', email: 'email' }]);
			expect(result2).deep.equal([{ id: 1, name: 'John', email: 'email' }]);

			this.db.run(sql`drop table another_users`);
			this.db.run(sql`drop table users12`);
			this.db.run(sql`drop table __drizzle_migrations`);
		} catch {
			throw new Error('migrate1 has broken');
		}
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does migrate1() do?
migrate1() is a function in the drizzle-orm codebase, defined in integration-tests/tests/sqlite/durable-objects/index.ts.
Where is migrate1() defined?
migrate1() is defined in integration-tests/tests/sqlite/durable-objects/index.ts at line 203.
What calls migrate1()?
migrate1() is called by 1 function(s): default.fetch.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free