Snake case table names

This commit is contained in:
Jorge Vargas 2024-09-24 20:58:24 -06:00
parent 971d4f2ce6
commit 3530c46b0e
4 changed files with 1728 additions and 12 deletions

12
.sequelizerc Normal file
View file

@ -0,0 +1,12 @@
require('babel-register')
require('dotenv').config()
const path = require('path')
module.exports = {
// prettier-ignore
'config': JSON.parse(process.env.SEQUELIZE || '{}') || {},
'models-path': path.resolve('src/server/sequelize/models'),
'seeders-path': path.resolve('src/server/sequelize/seeders'),
'migrations-path': path.resolve('src/server/sequelize/migrations')
}

1718
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,6 @@
"astro:dev": "astro dev", "astro:dev": "astro dev",
"build": "npm run paraglide:compile && npm run gql:compile && astro build", "build": "npm run paraglide:compile && npm run gql:compile && astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro",
"gql:compile": "graphql-codegen", "gql:compile": "graphql-codegen",
"gql:watch": "graphql-codegen -w", "gql:watch": "graphql-codegen -w",
"paraglide:compile": "paraglide-js compile --project ./project.inlang --outdir ./src\\paraglide" "paraglide:compile": "paraglide-js compile --project ./project.inlang --outdir ./src\\paraglide"
@ -26,12 +25,16 @@
"@graphql-tools/resolvers-composition": "^7.0.1", "@graphql-tools/resolvers-composition": "^7.0.1",
"@graphql-tools/schema": "^10.0.4", "@graphql-tools/schema": "^10.0.4",
"@inlang/paraglide-astro": "^0.2.2", "@inlang/paraglide-astro": "^0.2.2",
"@sequelize/cli": "^7.0.0-alpha.42",
"@sequelize/core": "^7.0.0-alpha.37", "@sequelize/core": "^7.0.0-alpha.37",
"@sequelize/mysql": "^7.0.0-alpha.41", "@sequelize/mysql": "^7.0.0-alpha.41",
"astro": "^4.15.7", "astro": "^4.15.7",
"astro-icon": "^1.1.1", "astro-icon": "^1.1.1",
"auth-astro": "^4.1.2", "auth-astro": "^4.1.2",
"babel-register": "^6.26.0",
"bcrypt": "^5.1.1", "bcrypt": "^5.1.1",
"dotenv": "^16.4.5",
"fs-extra": "^11.2.0",
"graphql-scalars": "^1.23.0", "graphql-scalars": "^1.23.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"tailwindcss": "^3.4.12", "tailwindcss": "^3.4.12",

View file

@ -1,9 +1,10 @@
import { DataTypes, Model, type BelongsToManyGetAssociationsMixin, type CreationOptional, type InferAttributes, type InferCreationAttributes, type NonAttribute } from '@sequelize/core'; import { DataTypes, Model, type BelongsToManyGetAssociationsMixin, type CreationOptional, type InferAttributes, type InferCreationAttributes, type NonAttribute } from '@sequelize/core';
import { Attribute, PrimaryKey, AutoIncrement, Default, BelongsToMany } from '@sequelize/core/decorators-legacy'; import { Attribute, PrimaryKey, AutoIncrement, Default, BelongsToMany, Table } from '@sequelize/core/decorators-legacy';
import Category from './category'; import Category from './category';
import Artist from './artist'; import Artist from './artist';
Table({ tableName: 'albums' })
export default class Album extends Model<InferAttributes<Album>, InferCreationAttributes<Album>> { export default class Album extends Model<InferAttributes<Album>, InferCreationAttributes<Album>> {
@Attribute(DataTypes.INTEGER) @Attribute(DataTypes.INTEGER)
@PrimaryKey @PrimaryKey
@ -28,7 +29,7 @@ export default class Album extends Model<InferAttributes<Album>, InferCreationAt
@Attribute(DataTypes.STRING) @Attribute(DataTypes.STRING)
declare description: string declare description: string
@Attribute(DataTypes.ENUM('show', 'hidden', 'coming')) @Attribute(DataTypes.STRING)
@Default('hidden') @Default('hidden')
declare status: CreationOptional<string> declare status: CreationOptional<string>