Skip to content

week 9 : question about dotenv configuration and ningle-auth/migrations.lisp #9

@truedat101

Description

@truedat101

I am running through week 9, and I couldn't figure out where we should be loading the connection and configuration for that connection in regards to migrations.lisp.

If I call migrate it doesn't have a connection, right? What am I missing? It seems a bit different from the migrations.main in ningle-tutorial-project because that project now uses contrib.lisp.

(defpackage ningle-auth/migrations
  (:use :cl :mito)
  (:export #:migrate))

(in-package :ningle-auth/migrations)

(defun migrate ()
  "Explicitly apply migrations when called."
  (format t "Applying migrations...~%")
  (mito:ensure-table-exists 'ningle-auth/models:user)
  (mito:ensure-table-exists 'ningle-auth/models:role)
  (mito:ensure-table-exists 'ningle-auth/models:permission)
  (mito:ensure-table-exists 'ningle-auth/models:token)
  (mito:migrate-table 'ningle-auth/models:user)
  (mito:migrate-table 'ningle-auth/models:role)
  (mito:migrate-table 'ningle-auth/models:permission)
  (mito:migrate-table 'ningle-auth/models:token)
  (create-dao 'ningle-auth/models:role :name "admin" :description "Admin")
  (create-dao 'ningle-auth/models:role :name "user" :description "User")
  (format t "Migrations complete.~%"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions