3 Commits

  1. 13
      CHANGELOG.md
  2. 7
      README.md
  3. 0
      assets/css/_inter.css
  4. 0
      assets/css/_ok.css
  5. 7
      assets/css/app.css
  6. 2
      mix.exs
  7. 6
      priv/repo/migrations/20210108235219_create_notes.exs
  8. 11
      priv/repo/migrations/20210109130905_create_settings.exs
  9. 29
      priv/repo/migrations/20210111174337_add_settings_data.exs
  10. 9
      priv/repo/migrations/20210202224744_add_title_to_note.exs
  11. 6
      priv/repo/migrations/20210203075035_create_links.exs
  12. 13
      priv/repo/migrations/20210205175108_add_html_fields.exs
  13. 24
      priv/repo/migrations/20210206173536_add_settings_data2.exs
  14. 4
      priv/repo/migrations/20210207093552_create_notes_topics.exs
  15. 24
      priv/repo/migrations/20210207200506_add_settings_data_3.exs
  16. 2
      priv/repo/migrations/20210209183415_create_notes_notes.exs
  17. 17
      priv/repo/migrations/20210210184450_remove_timestamps_from_join_tables.exs
  18. 4
      priv/repo/migrations/20210215182411_create_notes_links.exs
  19. 24
      priv/repo/migrations/20210215183316_migrate_links_to_join_table.exs
  20. 8
      priv/repo/migrations/20210215193839_add_domain_to_link.exs
  21. 11
      priv/repo/migrations/20210219221843_add_trigram_extension.exs
  22. 10
      priv/repo/migrations/20210221112501_add_views_and_last_viewed_to_notes.exs
  23. 2
      priv/repo/migrations/20210223202011_create_links_topics.exs
  24. 24
      priv/repo/migrations/20210225070255_add_setting_data3.exs
  25. 9
      priv/repo/migrations/20210310073420_add_list_id_to_note.exs
  26. 7
      priv/repo/migrations/20210313231739_make_link_url_unique.exs
  27. 10
      priv/repo/migrations/20210315074154_add_content_to_link.exs
  28. 9
      priv/repo/migrations/20210320220624_add_timestamps_to_links.exs

13
CHANGELOG.md

@ -5,6 +5,19 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
<!-- changelog -->
## [v0.89.0](https://git.inhji.de/inhji/mirage/compare/v0.88.0...v0.89.0) (2021-03-27)
### Chores:
* rename imported css files
### Features:
* omg completely rewrite migrations, fingers crossed this works!
## [v0.88.0](https://git.inhji.de/inhji/mirage/compare/v0.87.0...v0.88.0) (2021-03-24)

7
README.md

@ -12,4 +12,9 @@ To start your Phoenix server:
* Install dependencies with `mix deps.get`
* Create and migrate your database with `mix ecto.setup`
* Install Node.js dependencies with `npm install` inside the `assets` directory
* Start Phoenix endpoint with `mix phx.server`
* Start Phoenix endpoint with `mix phx.server`
To Set up the database
* Create the tables `mix ecto.setup`
* Install the Postgres Trigram Extension `CREATE EXTENSION IF NOT EXISTS pg_trgm;`

0
assets/css/inter.css → assets/css/_inter.css

0
assets/css/ok.css → assets/css/_ok.css

7
assets/css/app.css

@ -2,8 +2,8 @@
@import "@yaireo/tagify/dist/tagify.css";
@import "bootstrap-icons/font/bootstrap-icons.css";
@import "./inter.css";
@import "./ok.css";
@import "./_inter.css";
@import "./_ok.css";
@custom-media --smol (max-width: 45em);
@ -23,7 +23,7 @@
--gray-dark: #343a40;
--gray-light: #cccccc;
--primary: var(--red);
--primary: mediumseagreen;
--secondary: var(--gray);
--success: var(--green);
--info: var(--teal);
@ -32,7 +32,6 @@
--light: var(--white);
--dark: var(--gray-dark);
--width-main: 100%;
--background-navigation: var(--dark);
--color-navigation: var(--light);
--width-sidebar: 15rem;

2
mix.exs

@ -1,7 +1,7 @@
defmodule Mirage.MixProject do
use Mix.Project
@version "0.88.0"
@version "0.89.0"
def project do
[

6
priv/repo/migrations/20210108235219_create_notes.exs

@ -3,7 +3,13 @@ defmodule Mirage.Repo.Migrations.CreateNotes do
def change do
create table(:notes) do
add :title, :string, default: "Untitled Note"
add :content, :text
add :content_html, :text
add :views, :integer, default: 0
add :viewed_at, :naive_datetime
add :list_id, :integer
timestamps()
end

11
priv/repo/migrations/20210109130905_create_settings.exs

@ -1,20 +1,15 @@
defmodule Mirage.Repo.Migrations.CreateSettings do
use Ecto.Migration
def up do
def change do
create table(:settings) do
add :name, :string
add :value, :string
add :value_html, :string
add :value, :text
add :value_html, :text
timestamps()
end
create unique_index(:settings, [:name])
end
def down do
drop unique_index(:settings, [:name])
drop table(:settings)
end
end

29
priv/repo/migrations/20210111174337_add_settings_data.exs

@ -5,7 +5,7 @@ defmodule Mirage.Repo.Migrations.AddSettingsData do
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["user_tagline", "user_title", "footer_text"]
@settings ["user_tagline", "user_title", "footer_text", "header_title", "favicon", "daily_template"]
def up do
Multi.new()
@ -14,8 +14,31 @@ defmodule Mirage.Repo.Migrations.AddSettingsData do
value: "some tagline",
value_html: "some tagline"
})
|> Multi.insert(:user_title, %Setting{name: "user_title", value: "Hi", value_html: "Hi"})
|> Multi.insert(:footer_text, %Setting{name: "footer_text", value: "2020", value_html: "2020"})
|> Multi.insert(:user_title, %Setting{
name: "user_title",
value: "Hi",
value_html: "Hi"
})
|> Multi.insert(:footer_text, %Setting{
name: "footer_text",
value: "2020",
value_html: "2020"
})
|> Multi.insert(:header_title, %Setting{
name: "header_title",
value: "Mirage",
value_html: "Mirage"
})
|> Multi.insert(:header_title, %Setting{
name: "favicon",
value: "😀",
value_html: "😀"
})
|> Multi.insert(:daily_template, %Setting{
name: "daily_template",
value: "Something",
value_html: "Something"
})
|> repo().transaction()
end

9
priv/repo/migrations/20210202224744_add_title_to_note.exs

@ -1,9 +0,0 @@
defmodule Mirage.Repo.Migrations.AddTitleToNote do
use Ecto.Migration
def change do
alter table(:notes) do
add :title, :string, default: "Untitled Note"
end
end
end

6
priv/repo/migrations/20210203075035_create_note_links.exs → priv/repo/migrations/20210203075035_create_links.exs

@ -2,14 +2,18 @@ defmodule Mirage.Repo.Migrations.CreateNoteLinks do
use Ecto.Migration
def change do
create table(:note_links) do
create table(:links) do
add :title, :string
add :url, :string
add :content, :text, default: ""
add :content_html, :text, default: ""
add :note_id, references(:notes, on_delete: :nothing)
timestamps()
end
create index(:note_links, [:note_id])
create unique_index(:links, [:url])
end
end

13
priv/repo/migrations/20210205175108_add_html_fields.exs

@ -1,13 +0,0 @@
defmodule Mirage.Repo.Migrations.AddHtmlFields do
use Ecto.Migration
def change do
alter table(:settings) do
modify :value, :text
end
alter table(:notes) do
add :content_html, :text
end
end
end

24
priv/repo/migrations/20210206173536_add_settings_data2.exs

@ -1,24 +0,0 @@
defmodule Mirage.Repo.Migrations.AddSettingsData2 do
use Ecto.Migration
alias Mirage.Settings.Setting
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["header_title"]
def up do
Multi.new()
|> Multi.insert(:header_title, %Setting{
name: "header_title",
value: "Mirage",
value_html: "Mirage"
})
|> repo().transaction()
end
def down do
from(s in Setting, where: s.name in @settings)
|> repo().delete_all()
end
end

4
priv/repo/migrations/20210207093552_create_note_topics.exs → priv/repo/migrations/20210207093552_create_notes_topics.exs

@ -1,4 +1,4 @@
defmodule Mirage.Repo.Migrations.CreateNoteTopics do
defmodule Mirage.Repo.Migrations.CreateNotesTopics do
use Ecto.Migration
def change do
@ -16,8 +16,6 @@ defmodule Mirage.Repo.Migrations.CreateNoteTopics do
create table(:notes_topics) do
add :note_id, references(:notes, on_delete: :delete_all)
add :topic_id, references(:topics, on_delete: :nothing)
timestamps()
end
create index(:notes_topics, [:note_id])

24
priv/repo/migrations/20210207200506_add_settings_data_3.exs

@ -1,24 +0,0 @@
defmodule Mirage.Repo.Migrations.AddSettingsData3 do
use Ecto.Migration
alias Mirage.Settings.Setting
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["favicon"]
def up do
Multi.new()
|> Multi.insert(:header_title, %Setting{
name: "favicon",
value: "😀",
value_html: "😀"
})
|> repo().transaction()
end
def down do
from(s in Setting, where: s.name in @settings)
|> repo().delete_all()
end
end

2
priv/repo/migrations/20210209183415_create_note_note.exs → priv/repo/migrations/20210209183415_create_notes_notes.exs

@ -1,4 +1,4 @@
defmodule Mirage.Repo.Migrations.CreateNoteNote do
defmodule Mirage.Repo.Migrations.CreateNotesNotes do
use Ecto.Migration
def change do

17
priv/repo/migrations/20210210184450_remove_timestamps_from_join_tables.exs

@ -1,17 +0,0 @@
defmodule Mirage.Repo.Migrations.RemoveTimestampsFromJoinTables do
use Ecto.Migration
def change do
alter table(:notes_topics) do
remove :inserted_at
remove :updated_at
end
alter table(:note_links) do
remove :inserted_at
remove :updated_at
end
rename table(:note_links), to: table(:notes_links)
end
end

4
priv/repo/migrations/20210215182411_add_notes_links_join_table.exs → priv/repo/migrations/20210215182411_create_notes_links.exs

@ -1,9 +1,7 @@
defmodule Mirage.Repo.Migrations.AddNotesLinksJoinTable do
defmodule Mirage.Repo.Migrations.CreateNotesLinks do
use Ecto.Migration
def change do
rename table(:notes_links), to: table(:links)
create table(:notes_links) do
add :note_id, references(:notes, on_delete: :delete_all)
add :link_id, references(:links, on_delete: :delete_all)

24
priv/repo/migrations/20210215183316_migrate_links_to_join_table.exs

@ -1,24 +0,0 @@
defmodule Mirage.Repo.Migrations.MigrateLinksToJoinTable do
use Ecto.Migration
import Ecto.Query
def change do
alter table(:links) do
add :domain, :string
end
execute(&link_join_up/0, &link_join_down/0)
end
def link_join_up() do
links =
repo().all(from(l in Mirage.Links.Link))
|> Enum.map(fn l -> %{note_id: l.note_id, link_id: l.id} end)
repo().insert_all("notes_links", links)
end
def link_join_down() do
repo().query!("DELETE FROM notes_links")
end
end

8
priv/repo/migrations/20210215193839_add_domain_to_link.exs

@ -1,8 +0,0 @@
defmodule Mirage.Repo.Migrations.AddDomainToLink do
use Ecto.Migration
# contents move to previous migration bc of a fuckup
# never change a migration!!! (from now on)
def change do
end
end

11
priv/repo/migrations/20210219221843_add_trigram_extension.exs

@ -1,11 +0,0 @@
defmodule Mirage.Repo.Migrations.AddTrigramExtension do
use Ecto.Migration
def up do
repo().query!("CREATE EXTENSION IF NOT EXISTS pg_trgm;")
end
def down do
repo().query!("DROP EXTENSION IF EXISTS pg_trgm;")
end
end

10
priv/repo/migrations/20210221112501_add_views_and_last_viewed_to_notes.exs

@ -1,10 +0,0 @@
defmodule Mirage.Repo.Migrations.AddViewsAndLastViewedToNotes do
use Ecto.Migration
def change do
alter table(:notes) do
add :views, :integer, default: 0
add :viewed_at, :naive_datetime
end
end
end

2
priv/repo/migrations/20210223202011_create_link_topic.exs → priv/repo/migrations/20210223202011_create_links_topics.exs

@ -1,4 +1,4 @@
defmodule Mirage.Repo.Migrations.CreateLinkTopic do
defmodule Mirage.Repo.Migrations.CreateLinksTopics do
use Ecto.Migration
def change do

24
priv/repo/migrations/20210225070255_add_setting_data3.exs

@ -1,24 +0,0 @@
defmodule Mirage.Repo.Migrations.AddSettingsData3 do
use Ecto.Migration
alias Mirage.Settings.Setting
alias Ecto.Multi
import Ecto.Query, warn: false
@settings ["daily_template"]
def up do
Multi.new()
|> Multi.insert(:daily_template, %Setting{
name: "daily_template",
value: "Something",
value_html: "Something"
})
|> repo().transaction()
end
def down do
from(s in Setting, where: s.name in @settings)
|> repo().delete_all()
end
end

9
priv/repo/migrations/20210310073420_add_list_id_to_note.exs

@ -1,9 +0,0 @@
defmodule Mirage.Repo.Migrations.AddListIdToNote do
use Ecto.Migration
def change do
alter table(:notes) do
add :list_id, :integer
end
end
end

7
priv/repo/migrations/20210313231739_make_link_url_unique.exs

@ -1,7 +0,0 @@
defmodule Mirage.Repo.Migrations.MakeLinkURLUnique do
use Ecto.Migration
def change do
create unique_index(:links, [:url])
end
end

10
priv/repo/migrations/20210315074154_add_content_to_link.exs

@ -1,10 +0,0 @@
defmodule Mirage.Repo.Migrations.AddContentToLink do
use Ecto.Migration
def change do
alter table(:links) do
add :content, :text, default: ""
add :content_html, :text, default: ""
end
end
end

9
priv/repo/migrations/20210320220624_add_timestamps_to_links.exs

@ -1,9 +0,0 @@
defmodule Mirage.Repo.Migrations.AddTimestampsToLinks do
use Ecto.Migration
def change do
alter table(:links) do
timestamps default: "2021-01-01 00:00:01", null: false
end
end
end
Loading…
Cancel
Save