Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/2025 02 data type column #388

Merged
merged 20 commits into from
Feb 16, 2025

Conversation

takapi327
Copy link
Owner

@takapi327 takapi327 commented Feb 13, 2025

Implementation Details

If a column was to be given a data type or other setting, it had to be passed as an argument.
With this correction, it is now possible to define columns with data type characteristics.

In this method of definition, the column name can be used as the variable name, so it is no longer necessary to pass the column name as an argument.

class EntityTable extends Table[Entity]("entity"):
-  def c1: Column[Long] = column[Long]("ci", BIGINT, AUTO_INCREMENT)
+  def c1: Column[Long] = bigint().autoIncrement

Column names can change their format by implicitly passing Naming.
The default is CamelCase, but to change this to PascalCase, do the following

class EntityTable extends Table[Entity]("entity"):
  given Naming = Naming.PASCAL

  def c1: Column[Long] = bigint().autoIncrement

If you want to change the format of a particular column, you can still define it by passing the column name as an argument.

class EntityTable extends Table[Entity]("entity"):
  given Naming = Naming.PASCAL

  def c1: Column[Long] = bigint().autoIncrement
  def c2: Column[Long] = bigint("c_2")

Pull Request Checklist

  • Wrote unit and integration tests
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code formatting by scalafmt (sbt scalafmtAll command execution)
  • Add copyright headers to new files

References

@takapi327 takapi327 added 💪 enhancement Functional enhancement project:schema Addition and modification of functionality to Schema projects labels Feb 13, 2025
@takapi327 takapi327 added this to the 0.3.0 milestone Feb 13, 2025
@takapi327 takapi327 self-assigned this Feb 13, 2025
@takapi327 takapi327 merged commit 2f0ab77 into master Feb 16, 2025
27 checks passed
@takapi327 takapi327 deleted the enhancement/2025-02-DataType-Column branch February 16, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement Functional enhancement project:schema Addition and modification of functionality to Schema projects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant