| 405 | } |
| 406 | |
| 407 | func transConstraintOtoM(oracleConstraint *oracle_ast.InlineConstraint) (constraint *ast.ColumnOption) { |
| 408 | constraint = new(ast.ColumnOption) |
| 409 | switch oracleConstraint.Type { |
| 410 | case oracle_ast.ConstraintTypeNotNull: |
| 411 | constraint.Tp = ast.ColumnOptionNotNull |
| 412 | case oracle_ast.ConstraintTypeNull: |
| 413 | constraint.Tp = ast.ColumnOptionNull |
| 414 | case oracle_ast.ConstraintTypeUnique: |
| 415 | constraint.Tp = ast.ColumnOptionUniqKey |
| 416 | case oracle_ast.ConstraintTypePK: |
| 417 | constraint.Tp = ast.ColumnOptionPrimaryKey |
| 418 | case oracle_ast.ConstraintTypeReferences: |
| 419 | // todo |
| 420 | } |
| 421 | return |
| 422 | } |
| 423 | |
| 424 | // MySQL DEC/DECIMAL/NUMERIC type max scale is 30 |
| 425 | func LimitSize(dec int) int { |