Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Allow `remove_foreign_key` with both `to_table` and `options` | Ryuta Kamizono | 2019-03-06 | 1 | -1/+1 |
| | | | | | | | Foreign keys could be created to the same table. So `remove_foreign_key :from_table, :to_table` is sometimes ambiguous. This allows `remove_foreign_key` to remove the select one on the same table with giving both `to_table` and `options`. | ||||
* | Refactor `remove_foreign_key` to delete the foreign key before `alter_table` | Ryuta Kamizono | 2019-02-16 | 1 | -4/+2 |
| | |||||
* | SQLite3: Implement `add_foreign_key` and `remove_foreign_key` | Ryuta Kamizono | 2019-02-11 | 1 | -0/+28 |
| | | | | | | | | | | | | I implemented Foreign key create in `create_table` for SQLite3 at #24743. This follows #24743 to implement `add_foreign_key` and `remove_foreign_key`. Unfortunately SQLite3 has one limitation that `PRAGMA foreign_key_list(table-name)` doesn't have constraint name. So we couldn't implement find/remove foreign key by name for now. Fixes #35207. Closes #31343. | ||||
* | Make `t.timestamps` with precision by default | Ryuta Kamizono | 2019-01-26 | 1 | -1/+1 |
| | |||||
* | Use squiggly heredoc to strip odd indentation in the executed SQL | Ryuta Kamizono | 2018-11-22 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` After: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` | ||||
* | Enable `Performance/UnfreezeString` cop | yuuji.yaginuma | 2018-09-23 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ``` | ||||
* | SQLite3: Support multiple args function for expression indexes | Ryuta Kamizono | 2018-09-14 | 1 | -11/+12 |
| | | | | | Follow up #33874. Related #23393. | ||||
* | SQLite3 adapter supports expression indexes | gkemmey | 2018-09-13 | 1 | -1/+5 |
| | |||||
* | SQLite: Don't leak internal schema objects | Ryuta Kamizono | 2018-07-09 | 1 | -1/+5 |
| | | | | | | | | | | | | | | Related #31201. If creating custom primary key (like a string) in SQLite, it would also create an internal index implicitly which named begin with "sqlite_". It need to be hidden since the internal object names are reserved and prohibited for public use. See https://www.sqlite.org/fileformat2.html#intschema Fixes #33320. | ||||
* | Avoid using index_xinfo, only available in sqlite >= 3.8.9 | Paul Kuruvilla | 2017-10-25 | 1 | -9/+12 |
| | |||||
* | Save index order :desc to schema.rb (sqlite). Fixes #30902 | Paul Kuruvilla | 2017-10-24 | 1 | -2/+9 |
| | | | | | Although the sqlite adapter supports index sort orders, they weren't being written to db/schema.rb. | ||||
* | Remove deprecated argument `name` from `#indexes` | Rafael Mendonça França | 2017-10-23 | 1 | -7/+1 |
| | |||||
* | Move integer-like primary key normalization to `new_column_definition` | Ryuta Kamizono | 2017-09-23 | 1 | -4/+0 |
| | | | | | | Currently the normalization only exists in `primary_key` shorthand. It should be moved to `new_column_definition` to also affect to `add_column` with primary key. | ||||
* | Refactor `SchemaDumper` to make it possible to adapter specific customization | Ryuta Kamizono | 2017-08-22 | 1 | -0/+4 |
| | | | | | | | Currently `SchemaDumper` is only customizable for column options. But 3rd party connection adapters (oracle-enhanced etc) need to customizable for table or index dumping also. To make it possible, I introduced adapter specific `SchemaDumper` classes for that. | ||||
* | Place `update_table_definition` consistently in `SchemaStatements` | Ryuta Kamizono | 2017-08-21 | 1 | -0/+4 |
| | |||||
* | Use frozen-string-literal in ActiveRecord | Kir Shatrov | 2017-07-19 | 1 | -0/+2 |
| | |||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Merge pull request #29540 from kirs/rubocop-frozen-string | Matthew Draper | 2017-07-02 | 1 | -0/+1 |
|\ | | | | | | | Enforce frozen string in Rubocop | ||||
| * | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | | |||||
* | | Merge pull request #29506 from pat/frozen-string-literals | Matthew Draper | 2017-07-02 | 1 | -1/+1 |
|\ \ | | | | | | | | | | Make ActiveSupport frozen-string-literal friendly. | ||||
| * | | Make ActiveRecord frozen string literal friendly. | Pat Allan | 2017-06-20 | 1 | -1/+1 |
| |/ | |||||
* / | Don't cache queries for schema statements | Ryuta Kamizono | 2017-06-30 | 1 | -1/+1 |
|/ | | | | | | `test_middleware_caches` is sometimes failed since #29454. The failure is due to schema statements are affected by query caching. Bypassing query caching for schema statements to avoid the issue. | ||||
* | Refactor `indexes` things in connection adapters | Ryuta Kamizono | 2017-04-16 | 1 | -0/+35 |
| | | | | | | | * Use keyword arguments in `IndexDefinition` to ease to ignore unused options and to avoid to initialize incorrect empty value. * Place it in `SchemaStatements` for consistency. * And tiny tweaks. | ||||
* | Make internal methods to private | Ryuta Kamizono | 2017-03-27 | 1 | -0/+25 |
| | |||||
* | Extract `data_source_sql` to refactor data source statements | Ryuta Kamizono | 2017-02-20 | 1 | -0/+32 |