@bejibun/database 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/make/MakeMigrationCommand.js +2 -2
- package/commands/make/MakeSeederCommand.js +2 -2
- package/package.json +4 -2
- package/stubs/database/migrations/migration_template.ts +13 -0
- package/stubs/database/seeders/seeder_template.ts +5 -0
- /package/{database → stubs/database}/migrations/migration_template.d.ts +0 -0
- /package/{database → stubs/database}/migrations/migration_template.js +0 -0
- /package/{database → stubs/database}/seeders/seeder_template.d.ts +0 -0
- /package/{database → stubs/database}/seeders/seeder_template.js +0 -0
|
@@ -37,10 +37,10 @@ export default class MakeMigrationCommand {
|
|
|
37
37
|
}
|
|
38
38
|
const file = args;
|
|
39
39
|
const migrationsDirectory = "migrations";
|
|
40
|
-
const migrationsPath = path.resolve(__dirname, `../../database/${migrationsDirectory}`);
|
|
40
|
+
const migrationsPath = path.resolve(__dirname, `../../stubs/database/${migrationsDirectory}`);
|
|
41
41
|
const migrations = Array.from(new Bun.Glob("**/*").scanSync({
|
|
42
42
|
cwd: migrationsPath
|
|
43
|
-
})).filter(value => (/\.
|
|
43
|
+
})).filter(value => (/\.ts$/.test(value) &&
|
|
44
44
|
!value.endsWith(".d.ts")));
|
|
45
45
|
const template = migrations.find(value => value.includes("migration_template"));
|
|
46
46
|
if (isEmpty(template)) {
|
|
@@ -37,10 +37,10 @@ export default class MakeSeederCommand {
|
|
|
37
37
|
}
|
|
38
38
|
const file = args;
|
|
39
39
|
const seedersDirectory = "seeders";
|
|
40
|
-
const seedersPath = path.resolve(__dirname, `../../database/${seedersDirectory}`);
|
|
40
|
+
const seedersPath = path.resolve(__dirname, `../../stubs/database/${seedersDirectory}`);
|
|
41
41
|
const seeders = Array.from(new Bun.Glob("**/*").scanSync({
|
|
42
42
|
cwd: seedersPath
|
|
43
|
-
})).filter(value => (/\.
|
|
43
|
+
})).filter(value => (/\.ts$/.test(value) &&
|
|
44
44
|
!value.endsWith(".d.ts")));
|
|
45
45
|
const template = seeders.find(value => value.includes("seeder_template"));
|
|
46
46
|
if (isEmpty(template)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bejibun/database",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"author": "Havea Crenata <havea.crenata@gmail.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,11 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"alias": "bunx tsc-alias -p tsconfig.json",
|
|
30
|
+
"clean-stubs": "rm -rf stubs",
|
|
31
|
+
"stubs": "cp -rf src/stubs dist",
|
|
30
32
|
"rsync": "rsync -a dist/ ./",
|
|
31
33
|
"clean": "rm -rf dist",
|
|
32
|
-
"build": "bunx tsc -p tsconfig.json && bun run alias && bun run rsync && bun run clean",
|
|
34
|
+
"build": "bun run clean-stubs && bunx tsc -p tsconfig.json && bun run alias && bun run stubs && bun run rsync && bun run clean",
|
|
33
35
|
"deploy": "bun run build && bun publish --access public"
|
|
34
36
|
},
|
|
35
37
|
"type": "module",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type {Knex} from "knex";
|
|
2
|
+
|
|
3
|
+
export function up(knex: Knex): Knex.SchemaBuilder {
|
|
4
|
+
return knex.schema.createTable("tests", (table: Knex.TableBuilder) => {
|
|
5
|
+
table.bigIncrements("id");
|
|
6
|
+
table.timestamps(true, true);
|
|
7
|
+
table.timestamp("deleted_at");
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function down(knex: Knex): Knex.SchemaBuilder {
|
|
12
|
+
return knex.schema.dropTable("tests");
|
|
13
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|