13301

rails decimal precision and scale

I have about 30 tables in a rails app and there are about 6 tables for which I would like to change the precision and scale of some of the decimal columns. How do you go about doing that for already existing columns? Do you need to do each new migration separately, or can they all be done at once.

Answer1:

change_column :table_name, :column_name, :type will update the column's type.

Ref: http://apidock.com/rails/ActiveRecord/ConnectionAdapters/SchemaStatements/change_column

Recommend

  • Django implementation of default value in database
  • insert into a MySQL database on a different server
  • Measure heap used by each object in Java [closed]
  • Entity Framework Core 1.0.1 add-migration
  • How are 32 bit JavaScript numbers resulting from a bit-wise operation converted back to 64 bit numbe
  • Fraction length
  • Can't find cygwin setup.exe file?
  • Jooq casting String to BigDecimal
  • CUDA NSight is not installed with CUDA 5.0 installation file on Windows 8? [closed]
  • Flex/AS3 very strange simple Number operation issue
  • Type safe keys with Entity Framework model
  • Error while using PDF Kit
  • apply a javascript function to draggable copy
  • Two Tables Serving as one Model in Rails
  • How to override value that appears in a dropdown in the rails_admin gem
  • WPF version of .ScaleControl?
  • Primefaces :radioButton inside a ui:repeat
  • blade.php method outputting it's result to the form
  • R convert summary result (statistics with all dataframe columns) into dataframe
  • Azure table store snapshot/backup capability
  • Bigquery event streaming and table creation
  • How to detect interior vertices in groups of 2d polygons? (E.g. ZIP Codes to determine a territory)
  • Android changing fragment order inside FragmentPagerAdapter
  • Cannot upload to OneDrive using the new SDK
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • D3 get axis values on zoom event
  • Breaking out column by groups in Pandas
  • Loading .coffee files via a view in Rails
  • Unable to get column index with table.getColumn method using custom table Model
  • Create DicomImage from scratch using Dcmtk
  • Groovy: Unexpected token “:”
  • Linq Objects Group By & Sum
  • req.body is undefined - nodejs
  • Fill an image in a square container while keeping aspect ratio
  • Deserializing XML into class C#
  • Symfony2: How to get request parameter
  • Large data - storage and query
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • Buffer size for converting unsigned long to string