lib/sequel/adapters/shared/mysql.rb in sequel-3.43.0 vs lib/sequel/adapters/shared/mysql.rb in sequel-3.44.0

- old
+ new

@@ -348,10 +348,19 @@ end "#{super}#{" ENGINE=#{engine}" if engine}#{" DEFAULT CHARSET=#{charset}" if charset}#{" DEFAULT COLLATE=#{collate}" if collate}" end + DATABASE_ERROR_REGEXPS = { + /Duplicate entry .+ for key/ => UniqueConstraintViolation, + /foreign key constraint fails/ => ForeignKeyConstraintViolation, + /cannot be null/ => NotNullConstraintViolation, + }.freeze + def database_error_regexps + DATABASE_ERROR_REGEXPS + end + # Backbone of the tables and views support using SHOW FULL TABLES. def full_tables(type, opts) m = output_identifier_meth metadata_dataset.with_sql('SHOW FULL TABLES').server(opts[:server]).map{|r| m.call(r.values.first) if r.delete(:Table_type) == type}.compact end @@ -425,9 +434,14 @@ end end # MySQL can combine multiple alter table ops into a single query. def supports_combining_alter_table_ops? + true + end + + # MySQL supports CREATE OR REPLACE VIEW. + def supports_create_or_replace_view? true end # Respect the :size option if given to produce # tinyblob, mediumblob, and longblob if :tiny,