Merge pull request #7 from dNitza/use-hanami-22b1-pt2
Upgrade to Hanami 2.2.0.beta1 — Part 2
This commit is contained in:
21
bin/hanami
21
bin/hanami
@@ -4,26 +4,7 @@
|
||||
require "bundler/setup"
|
||||
require "hanami/cli"
|
||||
|
||||
# Hanami 2.0 does does not officially include database integration. However, much of the required
|
||||
# work is already done and included in the gem.
|
||||
#
|
||||
# This CLI shim activates the database commands so we can manage our app database.
|
||||
|
||||
Hanami::CLI.tap do |cli|
|
||||
cli.register "db create", Hanami::CLI::Commands::App::DB::Create
|
||||
cli.register "db create_migration", Hanami::CLI::Commands::App::DB::CreateMigration
|
||||
cli.register "db drop", Hanami::CLI::Commands::App::DB::Drop
|
||||
cli.register "db migrate", Hanami::CLI::Commands::App::DB::Migrate
|
||||
cli.register "db setup", Hanami::CLI::Commands::App::DB::Setup
|
||||
cli.register "db reset", Hanami::CLI::Commands::App::DB::Reset
|
||||
cli.register "db rollback", Hanami::CLI::Commands::App::DB::Rollback
|
||||
cli.register "db sample_data", Hanami::CLI::Commands::App::DB::SampleData
|
||||
cli.register "db seed", Hanami::CLI::Commands::App::DB::Seed
|
||||
cli.register "db structure dump", Hanami::CLI::Commands::App::DB::Structure::Dump
|
||||
cli.register "db version", Hanami::CLI::Commands::App::DB::Version
|
||||
end
|
||||
|
||||
Hanami::CLI::Bundler.require(:cli)
|
||||
|
||||
cli = Dry::CLI.new(Hanami::CLI)
|
||||
cli.call
|
||||
cli.call
|
||||
|
@@ -2,8 +2,8 @@
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 15.1
|
||||
-- Dumped by pg_dump version 15.1
|
||||
-- Dumped from database version 16.1
|
||||
-- Dumped by pg_dump version 16.1
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
@@ -227,6 +227,20 @@ CREATE FUNCTION public.que_state_notify() RETURNS trigger
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: update_updated_at_column(); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.update_updated_at_column() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = (now() at time zone 'utc');
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: auto_taggings; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -253,6 +267,31 @@ ALTER TABLE public.auto_taggings ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDE
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: highlights; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.highlights (
|
||||
id integer NOT NULL,
|
||||
post_id integer NOT NULL,
|
||||
text text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: highlights_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE public.highlights ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
SEQUENCE NAME public.highlights_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: login_tokens; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -289,7 +328,8 @@ CREATE TABLE public.movies (
|
||||
year integer,
|
||||
url text NOT NULL,
|
||||
watched_at date,
|
||||
imdb_id text
|
||||
imdb_id text,
|
||||
rating double precision DEFAULT 0.0
|
||||
);
|
||||
|
||||
|
||||
@@ -316,7 +356,11 @@ CREATE TABLE public.pages (
|
||||
name text NOT NULL,
|
||||
content text NOT NULL,
|
||||
slug text NOT NULL,
|
||||
published_at date
|
||||
published_at date,
|
||||
main_menu boolean DEFAULT false,
|
||||
light_colour text,
|
||||
dark_colour text,
|
||||
updated_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@@ -334,6 +378,35 @@ ALTER TABLE public.pages ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcast_scrobbles; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.podcast_scrobbles (
|
||||
id integer NOT NULL,
|
||||
overcast_id text,
|
||||
podcast_name text,
|
||||
title text,
|
||||
url text,
|
||||
enclosure_url text,
|
||||
listened_at date
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcast_scrobbles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE public.podcast_scrobbles ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
SEQUENCE NAME public.podcast_scrobbles_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcasts; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -397,7 +470,12 @@ CREATE TABLE public.posts (
|
||||
location text,
|
||||
cached_content text,
|
||||
book_status text,
|
||||
book_author text
|
||||
book_author text,
|
||||
is_read boolean DEFAULT false,
|
||||
programming_language text,
|
||||
commentable boolean DEFAULT false,
|
||||
in_reply_to text,
|
||||
emoji text
|
||||
);
|
||||
|
||||
|
||||
@@ -464,6 +542,31 @@ CREATE TABLE public.que_values (
|
||||
WITH (fillfactor='90');
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.reactions (
|
||||
id integer NOT NULL,
|
||||
post_id integer NOT NULL,
|
||||
visitor_identifier text NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE public.reactions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
|
||||
SEQUENCE NAME public.reactions_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -564,7 +667,9 @@ CREATE TABLE public.webmentions (
|
||||
content_text text DEFAULT ''::text NOT NULL,
|
||||
source_url text DEFAULT ''::text NOT NULL,
|
||||
target_url text DEFAULT ''::text NOT NULL,
|
||||
post_id integer
|
||||
post_id integer,
|
||||
retrieval_attempts integer DEFAULT 0,
|
||||
last_checked_at timestamp without time zone
|
||||
);
|
||||
|
||||
|
||||
@@ -624,6 +729,14 @@ ALTER TABLE ONLY public.auto_taggings
|
||||
ADD CONSTRAINT auto_taggings_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: highlights highlights_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.highlights
|
||||
ADD CONSTRAINT highlights_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: login_tokens login_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -648,6 +761,14 @@ ALTER TABLE ONLY public.pages
|
||||
ADD CONSTRAINT pages_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcast_scrobbles podcast_scrobbles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.podcast_scrobbles
|
||||
ADD CONSTRAINT podcast_scrobbles_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcasts podcasts_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -696,6 +817,22 @@ ALTER TABLE ONLY public.que_values
|
||||
ADD CONSTRAINT que_values_pkey PRIMARY KEY (key);
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions reactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.reactions
|
||||
ADD CONSTRAINT reactions_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions reactions_post_id_visitor_identifier_key; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.reactions
|
||||
ADD CONSTRAINT reactions_post_id_visitor_identifier_key UNIQUE (post_id, visitor_identifier);
|
||||
|
||||
|
||||
--
|
||||
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -776,6 +913,13 @@ ALTER TABLE ONLY public.workouts
|
||||
ADD CONSTRAINT workouts_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: highlights_post_id_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX highlights_post_id_index ON public.highlights USING btree (post_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: pages_slug_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -783,6 +927,13 @@ ALTER TABLE ONLY public.workouts
|
||||
CREATE UNIQUE INDEX pages_slug_index ON public.pages USING btree (slug);
|
||||
|
||||
|
||||
--
|
||||
-- Name: podcast_scrobbles_overcast_id_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX podcast_scrobbles_overcast_id_index ON public.podcast_scrobbles USING btree (overcast_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs_args_gin_idx; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -811,6 +962,13 @@ CREATE INDEX que_jobs_kwargs_gin_idx ON public.que_jobs USING gin (kwargs jsonb_
|
||||
CREATE INDEX que_poll_idx ON public.que_jobs USING btree (job_schema_version, queue, priority, run_at, id) WHERE ((finished_at IS NULL) AND (expired_at IS NULL));
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions_post_id_index; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX reactions_post_id_index ON public.reactions USING btree (post_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_jobs que_job_notify; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
@@ -825,6 +983,13 @@ CREATE TRIGGER que_job_notify AFTER INSERT ON public.que_jobs FOR EACH ROW WHEN
|
||||
CREATE TRIGGER que_state_notify AFTER INSERT OR DELETE OR UPDATE ON public.que_jobs FOR EACH ROW WHEN ((NOT (COALESCE(current_setting('que.skip_notify'::text, true), ''::text) = 'true'::text))) EXECUTE FUNCTION public.que_state_notify();
|
||||
|
||||
|
||||
--
|
||||
-- Name: pages update_pages_updated_at; Type: TRIGGER; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TRIGGER update_pages_updated_at BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();
|
||||
|
||||
|
||||
--
|
||||
-- Name: auto_taggings auto_taggings_tag_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -833,6 +998,14 @@ ALTER TABLE ONLY public.auto_taggings
|
||||
ADD CONSTRAINT auto_taggings_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES public.tags(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: highlights highlights_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.highlights
|
||||
ADD CONSTRAINT highlights_post_id_fkey FOREIGN KEY (post_id) REFERENCES public.posts(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: post_tags post_tags_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -865,6 +1038,14 @@ ALTER TABLE ONLY public.post_trips
|
||||
ADD CONSTRAINT post_trips_trip_id_fkey FOREIGN KEY (trip_id) REFERENCES public.trips(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: reactions reactions_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.reactions
|
||||
ADD CONSTRAINT reactions_post_id_fkey FOREIGN KEY (post_id) REFERENCES public.posts(id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: top_tracks top_tracks_post_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
||||
--
|
||||
@@ -885,3 +1066,51 @@ ALTER TABLE ONLY public.webmentions
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
SET search_path TO "$user", public;
|
||||
|
||||
INSERT INTO schema_migrations (filename) VALUES
|
||||
('20230101035642_create_posts.rb'),
|
||||
('20230101113513_add_slug_to_posts.rb'),
|
||||
('20230101122416_add_unique_constraint_to_post_slug.rb'),
|
||||
('20230102075558_create_bookmarks.rb'),
|
||||
('20230103085913_add_slug_to_bookmarks.rb'),
|
||||
('20230103215123_create_tags.rb'),
|
||||
('20230103215311_combine_posts_and_bookmarks.rb'),
|
||||
('20230104085227_remove_not_null_constraint_on_post_content.rb'),
|
||||
('20230114093354_remove_not_null_constraint_on_post_name.rb'),
|
||||
('20230129040028_add_syndication_sources_to_posts.rb'),
|
||||
('20230131084956_add_photos_to_posts.rb'),
|
||||
('20230219064027_add_location_to_posts.rb'),
|
||||
('20230228095633_change_syndication_sources_type.rb'),
|
||||
('20230424120318_create_workouts.rb'),
|
||||
('20230425062935_add_duration_to_workouts.rb'),
|
||||
('20230501111415_create_movies.rb'),
|
||||
('20230506081449_create_auto_taggings.rb'),
|
||||
('20230507001217_add_cached_bookmark_to_post.rb'),
|
||||
('20230508101336_add_que.rb'),
|
||||
('20230509092845_create_trips.rb'),
|
||||
('20230509094041_create_post_trips.rb'),
|
||||
('20230510095407_add_subtitle_to_trips.rb'),
|
||||
('20230510105852_add_added_at_to_movies.rb'),
|
||||
('20230513012518_add_imdb_id_to_movies.rb'),
|
||||
('20230612061813_create_top_tracks.rb'),
|
||||
('20230618050051_create_podcasts.rb'),
|
||||
('20230626090009_add_book_posts.rb'),
|
||||
('20230704111528_create_webmentions.rb'),
|
||||
('20230825091941_add_summary_to_trips.rb'),
|
||||
('20231117222529_create_pages.rb'),
|
||||
('20231118054424_create_users.rb'),
|
||||
('20231118054707_create_login_token.rb'),
|
||||
('20231130095816_create_podcast_scrobbles.rb'),
|
||||
('20240101043215_add_menu_fields_to_pages.rb'),
|
||||
('20240125232452_add_rating_to_movies.rb'),
|
||||
('20240210231532_add_retrieval_attempt_to_webmentions.rb'),
|
||||
('20240210232136_add_last_checked_at_to_webmentions.rb'),
|
||||
('20240222205406_add_read_status_to_bookmarks.rb'),
|
||||
('20240303091643_add_updated_at_to_pages.rb'),
|
||||
('20240304095229_add_programming_language_to_posts.rb'),
|
||||
('20240309210727_add_commentable_to_posts.rb'),
|
||||
('20240321211120_add_in_reply_to_to_posts.rb'),
|
||||
('20240324053509_add_emoji_to_posts.rb'),
|
||||
('20240330213418_create_reactions.rb'),
|
||||
('20240405092210_create_highlights.rb');
|
@@ -19,7 +19,7 @@ else
|
||||
script/bootstrap
|
||||
|
||||
echo "==> Setting up database..."
|
||||
bin/hanami db setup
|
||||
hanami db structure load
|
||||
|
||||
echo "==> App is now ready to go!"
|
||||
fi
|
||||
|
@@ -9,9 +9,9 @@ cd "$(dirname "$0")/.."
|
||||
script/bootstrap
|
||||
|
||||
echo "==> Updating db…"
|
||||
bin/hanami db create
|
||||
hanami db create
|
||||
|
||||
bin/hanami db create -e test
|
||||
bin/hanami db reset -e test
|
||||
hanami db create -e test
|
||||
hanami db reset -e test
|
||||
|
||||
bin/hanami db migrate
|
||||
hanami db migrate
|
||||
|
Reference in New Issue
Block a user