-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from halvardssm/qb/fix-updated-at
Changed schema to use array instead of string for queries
- Loading branch information
Showing
19 changed files
with
142 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Schema } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Migration } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Schema } from "https://deno.land/x/nessie/qb.ts"; | ||
import Dex from "https://deno.land/x/dex/mod.ts"; | ||
|
||
export const up = (): string => { | ||
export const up: Migration = () => { | ||
// return new Schema() | ||
// return Dex | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import { Schema } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Migration } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Schema } from "https://deno.land/x/nessie/qb.ts"; | ||
|
||
export const up = (): string => { | ||
const sql1 = new Schema("pg").create("basic", (table) => { | ||
export const up: Migration = () => { | ||
const schema = new Schema("pg"); | ||
|
||
schema.create("basic", (table) => { | ||
table.id(); | ||
table.string("name", 100).nullable(); | ||
table.boolean("is_true").default("false"); | ||
table.custom("custom_column int default 1"); | ||
table.timestamps(); | ||
}); | ||
|
||
const sql2 = new Schema("pg").queryString( | ||
schema.queryString( | ||
"INSERT INTO users VALUES (DEFAULT, 'Deno', true, 2, DEFAULT, DEFAULT);", | ||
); | ||
|
||
return sql1 + sql2; | ||
return schema.query; | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
return new Schema("pg").drop("basic"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { Schema } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Migration } from "https://deno.land/x/nessie/mod.ts"; | ||
import { Schema } from "https://deno.land/x/nessie/qb.ts"; | ||
|
||
export const up = () => { | ||
export const up: Migration = () => { | ||
return new Schema().create("column_config", (table) => { | ||
table.string("name", 100).nullable().default("Deno"); | ||
table.integer("number").default("0").autoIncrement(); | ||
table.boolean("true").custom("default true"); | ||
}); | ||
}; | ||
|
||
export const down = () => { | ||
export const down: Migration = () => { | ||
return new Schema().drop("column_config"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import { Migration } from "https://deno.land/x/nessie/mod.ts"; | ||
import Dex from "https://deno.land/x/dex/mod.ts"; | ||
|
||
export const up = () => { | ||
export const up: Migration = () => { | ||
return Dex({ client: "mysql" }).schema.createTable("test", (table: any) => { | ||
table.bigIncrements("id").primary(); | ||
table.string("file_name", 100).unique(); | ||
table.timestamps(undefined, true); | ||
}); | ||
}; | ||
|
||
export const down = () => { | ||
export const down: Migration = () => { | ||
return Dex({ client: "mysql" }).schema.dropTable("test"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export const up = (): string => { | ||
import { Migration } from "../../mod.ts"; | ||
|
||
export const up: Migration = () => { | ||
return "CREATE TABLE testTable1 (id int);"; | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
return "DROP TABLE testTable1"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export const up = (): string => { | ||
import { Migration } from "../../mod.ts"; | ||
|
||
export const up: Migration = () => { | ||
return "CREATE TABLE testTable2 (id int);"; | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
return "DROP TABLE testTable2"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export const up = (): string => { | ||
import { Migration } from "../../mod.ts"; | ||
|
||
export const up: Migration = () => { | ||
return "CREATE TABLE testTable3 (id int);"; | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
return "DROP TABLE testTable3"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import { Migration } from "../../mod.ts"; | ||
import { dbDialects, Schema } from "../../qb.ts"; | ||
|
||
const dialect = Deno.env.get("DB_DIALECT") as dbDialects; | ||
|
||
export const up = (): string => { | ||
export const up: Migration = () => { | ||
return new Schema(dialect).create("basics", (table) => { | ||
table.id(); | ||
table.string("col_1", 10); | ||
// table.timestamps(); TODO FIX TIMESTAMPS | ||
table.timestamps(); | ||
table.enum("col_11", ["enum_1", "enum_2"]); | ||
}); | ||
}; | ||
|
||
export const down = (): string => { | ||
export const down: Migration = () => { | ||
return new Schema(dialect).drop("basics"); | ||
}; |
Oops, something went wrong.