Manual Installation
Create
mochi.crin initalizers and paste this in:require "mochi"Create a migration and paste in:
Granite:
```sql -- +micrate Up CREATE TABLE users ( id INTEGER NOT NULL PRIMARY KEY, email VARCHAR, password_digest VARCHAR, created_at TIMESTAMP, updated_at TIMESTAMP );
-- +micrate Down
DROP TABLE IF EXISTS users;
```
or
**Jennifer:**
```crystal
class CreateUser < Jennifer::Migration::Base
def up
create_table(:users) do |t|
t.string :email
t.string :password_digest
t.timestamp :created_at
t.timestamp :updated_at
end
end
def down
drop_table(:users)
end
end
```Migrate:
Granite:
or
Jennifer:
Create a controller titled
user_controller.crand paste in this file:Create a controller titled
session_controller.crand paste in this file:Add these to your routes:
Change
pipeline :webtopipeline :web, :authand add:Create an
:authpipeline with:Create a new route section just for
:auth:Add this to your
:webroutes:Create a piple titled
authenticate.crand paste in this file:Copy & Paste all the views found here:
Open
config/application.crand between the# Start Generator&# End Generatoradd:Open
application_controller.crand add:Done! And that's why we have a CLI.
Last updated
Was this helpful?