From 70211b24c51c968f7e7ef5365d06a8e481a3c2f8 Mon Sep 17 00:00:00 2001 From: Alex Turchyn Date: Tue, 4 Jul 2023 20:23:22 +0300 Subject: [PATCH] add mysql support --- Dockerfile | 2 +- Gemfile | 1 + Gemfile.lock | 2 ++ config/database.yml | 5 +++-- db/migrate/20230516180929_create_templates.rb | 6 +++--- db/migrate/20230612182744_create_submitters.rb | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index a7ead7ce..7b721a2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ ENV BUNDLE_WITHOUT="development:test" WORKDIR /app -RUN apk add --no-cache build-base sqlite-dev libpq-dev vips-dev vips-poppler vips-heif libc6-compat ttf-freefont +RUN apk add --no-cache build-base sqlite-dev libpq-dev mariadb-dev vips-dev vips-poppler vips-heif libc6-compat ttf-freefont COPY ./Gemfile ./Gemfile.lock ./ diff --git a/Gemfile b/Gemfile index ba270748..5c5e6dd7 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,7 @@ gem 'google-cloud-storage' gem 'hexapdf' gem 'image_processing' gem 'lograge' +gem 'mysql2' gem 'oj' gem 'pagy' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 9c95070f..831526da 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -286,6 +286,7 @@ GEM msgpack (1.7.1) multi_json (1.15.0) multipart-post (2.3.0) + mysql2 (0.5.5) net-http-persistent (4.0.2) connection_pool (~> 2.2) net-imap (0.3.6) @@ -507,6 +508,7 @@ DEPENDENCIES image_processing letter_opener_web lograge + mysql2 oj pagy pg diff --git a/config/database.yml b/config/database.yml index e29f2ff9..baad2599 100644 --- a/config/database.yml +++ b/config/database.yml @@ -10,7 +10,8 @@ test: <<: *default database: docuseal_test +<% if ENV['DATABASE_URL'].to_s.empty? %> production: - adapter: <%= ENV['DATABASE_URL'].present? ? 'postgresql' : 'sqlite3' %> - encoding: unicode + adapter: sqlite3 database: <%= ENV['WORKDIR'] || '.' %>/db.sqlite3 +<% end %> diff --git a/db/migrate/20230516180929_create_templates.rb b/db/migrate/20230516180929_create_templates.rb index e120a88b..ef254f96 100644 --- a/db/migrate/20230516180929_create_templates.rb +++ b/db/migrate/20230516180929_create_templates.rb @@ -5,9 +5,9 @@ class CreateTemplates < ActiveRecord::Migration[7.0] create_table :templates do |t| t.string :slug, null: false, index: { unique: true } t.string :name, null: false - t.string :schema, null: false - t.string :fields, null: false - t.string :submitters, null: false + t.text :schema, null: false + t.text :fields, null: false + t.text :submitters, null: false t.references :author, null: false, foreign_key: { to_table: :users }, index: true t.references :account, null: false, foreign_key: true, index: true diff --git a/db/migrate/20230612182744_create_submitters.rb b/db/migrate/20230612182744_create_submitters.rb index 0bf4a45a..db4c5dd9 100644 --- a/db/migrate/20230612182744_create_submitters.rb +++ b/db/migrate/20230612182744_create_submitters.rb @@ -8,7 +8,7 @@ class CreateSubmitters < ActiveRecord::Migration[7.0] t.string :uuid, null: false t.string :email, null: false, index: true t.string :slug, null: false, index: { unique: true } - t.string :values, null: false + t.text :values, null: false t.string :ua t.string :ip