Can I see your migration file
# help
t
Can I see your migration file
And what file extension is it using
k
Copy code
import {Kysely, sql} from 'kysely'
import { TABLENAMES} from '../shared/enums/table-names'

export async function up(db: Kysely<any>): Promise<void> {
    await  db.schema
        .createTable('user')
        .addColumn('id', 'uuid',(col) => col.primaryKey().defaultTo(sql`uuid_generate_v4()`))
        .addColumn('first_name', 'varchar(255)', (col) => col.notNull())
        .addColumn('last_name', 'varchar(255)', (col) => col.notNull())
        .addColumn('gender', 'varchar(255)', (col) => col.notNull())
        .addColumn('email', 'varchar(255)', (col) => col.notNull().unique())
        .addColumn('phone', 'varchar(11)')
        .addColumn('job_title', 'varchar(255)', (col) => col.notNull())
        .addColumn('birth_date', 'date')
        .addColumn('lockout', 'boolean', (col) => col.notNull().defaultTo(false))
        .execute();

    await db.insertInto('user')
        .values({
            first_name: 'Kabo',
            last_name: 'Mekgwe',
            gender: 'Male',
            email: '<mailto:kabokm@gmail.com|kabokm@gmail.com>',
            job_title: 'jsdfsd'
        });
}

export async function down(db: Kysely<any>): Promise<void> {
    await db.schema.dropTable('user').execute()
}
The file ext is .mjs
t
If you remove the shared enums import
Does it work
k
no its not working
t
Oh wait I see
You have type annotations this isn't a typescript file
Have to remove those, I'm gonna be working on supporting this today
Are you sure you removed all the type annotations
Search for the colon
k
I'll search for it through out the whole project
t
It should just be in the migrations files
k
hay @thdxr sorry for the late reply. i was a bit busy earlier on i managed to get it to work. You where right... i didn't consider that it wasn't a typescript file. i also used this example https://www.npmjs.com/package/kysely#query-examples
Out of curiosity, isn't there a way of automatically applying the migrations. I am wondering if i'd need to get into the console and apply the migrations on the production env
t
they run automatically when deploying in non-local mode
k
Thanks