Giter VIP home page Giter VIP logo

Comments (8)

cj avatar cj commented on July 19, 2024

maybe allow col :type, as: "ENUM('EMPLOYEE','CLIENT','SUPERUSER','DEVELOPER')"

from mini_record.

DAddYE avatar DAddYE commented on July 19, 2024

Thanks for suggestions, now you can:

class Mine > ActiveRecord::Base
   schema { |s| s.column :direction, "ENUM('inbound', 'outbound')" }
end

from mini_record.

cj avatar cj commented on July 19, 2024

Thank you for the quick response. So there seems to be a bug with that, if I do:

  col :first_name, index: true
  col :last_name, index: true
  schema { |s| s.column :type, "ENUM('EMPLOYEE','CLIENT','SUPERUSER','DEVELOPER')" }
  timestamps

I get Mysql::Error: Key column 'first_name' doesn't exist in table: CREATE INDEXindex_users_on_first_nameONusers(first_name)

But doing:

  schema { |s| s.column :type, "ENUM('EMPLOYEE','CLIENT','SUPERUSER','DEVELOPER')" }
  col :first_name, index: true
  col :last_name, index: true
  timestamps

Works.....

How hard do you think it would be to make it work like col :type, as: "ENUM('EMPLOYEE','CLIENT','SUPERUSER','DEVELOPER')" ? Looking at the code it doesn't look too difficult.... might fiddle around with it later (as I need it for an upcoming project)

from mini_record.

cj avatar cj commented on July 19, 2024

Also is there a reason why you wouldn't just do:

  schema { |t|
    t.string :first_name, :last_name, index: true
    t.column :type, "ENUM('EMPLOYEE','CLIENT','SUPERUSER','DEVELOPER')"
    t.timestamps
  }

Thank you for answering my questions :)

from mini_record.

DAddYE avatar DAddYE commented on July 19, 2024

Okey, was pretty complicated but seems fixed.

Could you check that now everything works great?

from mini_record.

cj avatar cj commented on July 19, 2024

@DAddYE Thank you, I'll test this out tomorrow!

from mini_record.

cj avatar cj commented on July 19, 2024

using col :direction, as: "ENUM('inbound', 'outbound')" works great! Thank you!

p.s. it still runs any schema and custom as: whenever you start up padrino:

10:08 ~/dropbox/sd/acd/receptionist (master *11)$ padrino start
DEPRECATION WARNING: Yajl's JSON gem compatibility API is going to be removed in 2.0
  DEBUG - [MiniRecord] Detected schema changed for calls.direction#type from "enum('inbound', 'outbound')" in "enum('inbound','outbound')"
  DEBUG -  (18.2ms)  ALTER TABLE `calls` CHANGE `direction` `direction` ENUM('inbound', 'outbound') DEFAULT NULL

But it's not too much of an issue as it doesn't seem to be doing it every page load now.

from mini_record.

DAddYE avatar DAddYE commented on July 19, 2024

Yep, pay attention to:

col :direction, as: "ENUM('inbound','outbound')"
"ENUM('inbound',>>without the space<<'outbound')"

That's the reason why u see:

...direction#type from "enum('inbound', 'outbound')" in "enum('inbound','outbound')"

from mini_record.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.