Skip to content

Commit

Permalink
Rename defineDB to defineDb (#10364)
Browse files Browse the repository at this point in the history
* Rename `defineDB` to `defineDb`

* Add changeset

* Improve changeset
  • Loading branch information
delucis authored Mar 8, 2024
1 parent b6ccaa6 commit 3f27e09
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .changeset/wet-kiwis-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@astrojs/db": minor
"astro": patch
---

Renames the Astro DB `defineDB()` helper to `defineDb()`

⚠️ Breaking change: update your imports from `astro:db` to use `defineDb` with a lowercase “b”.
4 changes: 2 additions & 2 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export default {
public-hoist-pattern[]=*lit*
`,
DB_CONFIG: `\
import { defineDB } from 'astro:db';
import { defineDb } from 'astro:db';
// https://astro.build/db/config
export default defineDB({
export default defineDb({
tables: {}
});
`,
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/runtime/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function defineTable<TColumns extends ColumnsConfig>(userConfig: TableCon
return userConfig;
}

export function defineDB(userConfig: DBConfigInput) {
export function defineDb(userConfig: DBConfigInput) {
return userConfig;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/basics/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Themes } from './theme';
import { column, defineDB, defineTable } from 'astro:db';
import { column, defineDb, defineTable } from 'astro:db';

const Author = defineTable({
columns: {
Expand All @@ -8,6 +8,6 @@ const Author = defineTable({
},
});

export default defineDB({
export default defineDb({
tables: { Author, Themes },
});
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/integrations/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { column, defineDB, defineTable } from 'astro:db';
import { column, defineDb, defineTable } from 'astro:db';

const Author = defineTable({
columns: {
Expand All @@ -7,6 +7,6 @@ const Author = defineTable({
},
});

export default defineDB({
export default defineDb({
tables: { Author },
});
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/integrations/integration/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { menu } from './shared';
import { defineDB } from 'astro:db';
import { defineDb } from 'astro:db';

export default defineDB({
export default defineDb({
tables: {
menu,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/recipes/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { column, defineDB, defineTable } from 'astro:db';
import { column, defineDb, defineTable } from 'astro:db';

const Recipe = defineTable({
columns: {
Expand All @@ -21,6 +21,6 @@ const Ingredient = defineTable({
foreignKeys: [{ columns: 'recipeId', references: () => [Recipe.columns.id] }],
});

export default defineDB({
export default defineDb({
tables: { Recipe, Ingredient },
});
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/ticketing-example/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { column, defineDB, defineTable } from 'astro:db';
import { column, defineDb, defineTable } from 'astro:db';

const Event = defineTable({
columns: {
Expand All @@ -24,4 +24,4 @@ const Ticket = defineTable({
},
});

export default defineDB({ tables: { Event, Ticket } });
export default defineDb({ tables: { Event, Ticket } });
2 changes: 1 addition & 1 deletion packages/db/virtual.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ declare module 'astro:db' {
export const TRUE: typeof import('./dist/runtime/config.js').TRUE;
export const FALSE: typeof import('./dist/runtime/config.js').FALSE;
export const column: typeof import('./dist/runtime/config.js').column;
export const defineDB: typeof import('./dist/runtime/config.js').defineDB;
export const defineDb: typeof import('./dist/runtime/config.js').defineDb;
export const defineTable: typeof import('./dist/runtime/config.js').defineTable;
}

0 comments on commit 3f27e09

Please sign in to comment.