legacy-database

Using raw sql queries in Rails 3 application?

烈酒焚心 提交于 2020-01-12 16:10:36
问题 I am working on migrating a legacy database into my Rails application (3.2.3). The original database comes with quite a few long sql queries for reports. For now, what I would like to do it use the sql queries in the Rails application and then one by one (when time allows) swap the sql queries to 'proper' Rails queries. I have a clinical model and the controller has the following code: @clinical_income_by_year = Clinical.find_all_by_sql(SELECT date_format(c.transactiondate,'%Y') as Year, date

Using raw sql queries in Rails 3 application?

浪子不回头ぞ 提交于 2020-01-12 16:10:04
问题 I am working on migrating a legacy database into my Rails application (3.2.3). The original database comes with quite a few long sql queries for reports. For now, what I would like to do it use the sql queries in the Rails application and then one by one (when time allows) swap the sql queries to 'proper' Rails queries. I have a clinical model and the controller has the following code: @clinical_income_by_year = Clinical.find_all_by_sql(SELECT date_format(c.transactiondate,'%Y') as Year, date

Django with legacy database - how to work with DB sequences?

馋奶兔 提交于 2019-12-25 04:07:54
问题 Given a database table that was created using this SQL query: CREATE TABLE Bill ( Time DATE NOT NULL , Address VARCHAR2 (60) NOT NULL , ID NUMBER NOT NULL ) ; ALTER TABLE Bill ADD CONSTRAINT Bill_PK PRIMARY KEY ( ID ) ; CREATE SEQUENCE Bill_ID_SEQ START WITH 1 NOCACHE ORDER ; CREATE OR REPLACE TRIGGER Bill_ID_TRG BEFORE INSERT ON Paragony FOR EACH ROW BEGIN :NEW.ID := Bill_ID_SEQ.NEXTVAL; END; I have to use it with Django ORM so I have run inspectdb command. It is the autogenerated code:

Hibernate chokes on missing rows when dealing with a legacy database

主宰稳场 提交于 2019-12-21 07:37:15
问题 I am trying to implement hibernate on a legacy database (that still has a legacy PHP client), and am running into some problems because the people who wrote the original app had no idea what they were doing. The database is set up so that none of the columns are nullable, so they default foreign keys to 0 if there is no record for them. Additionally, they don't have proper foreign keys on the tables so there are a few with invalid IDs. I do not have an option to change the schema or null the

Working with composite primary key in django project with legacy database

老子叫甜甜 提交于 2019-12-19 08:06:59
问题 I have a legacy database, where some table contains composite primary key. The model I get by running manage.py inspectdb command looks like this. class MyTable(models.Model): field1_id = models.IntegerField(db_column='field1id', primary_key=True) is_favorite = models.BooleanField(db_column='isfavorite', default=False, null=False) is_admin = models.BooleanField(db_column='isadmin', default=False, null=False) role = models.IntegerField(default=USER_GUEST, null=False) field2 = models

JPA OneToOne association where 2 entities use composite primary keys but use different column names?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 10:09:31
问题 We are trying to use Hibernate with a database that uses a lot of composite keys and it's been causing us a lot of headaches. Unfortunately, we can't change the schema so we have to do a lot of additional mapping betwen our fields. We are restricted to using JPA 1.0 and Hibernate 3.3. The biggest problem we've had so far is to do with a one-to-one association between two entities using a composite key of 2 values, where the tables have different names for these columns (the DB has a naming

CQRS with Legacy Systems

旧城冷巷雨未停 提交于 2019-12-12 07:57:19
问题 I'm looking to convert a relatively new web-based application with a clear domain model over to more of a CQRS style system. My new application is essentially an enhanced replacement of an older existing system. The existing systems in my organization share a set of common databases, which are updated by an untold number of applications (developed via the Chaos Method) that exist in silos throughout the company. (As it stands, I believe that no single person in the company can identify them

Grails project: Gorm or JPA/Hibernate annotations for legacy db mapping?

佐手、 提交于 2019-12-11 08:44:42
问题 In a grails app, I have to create a bunch of grails domain classes mapped to a very old db. This very old db is using a lots of "funky" unreadable names for tables and columns. These tables contains (too) often (too) many columns. I was thinking of using the static mapping for all the relationship and using the JPA annotations for the columns names (almost all columns needs to be renamed and the mapping section will be elephantine) Is this kind of mix is possible ? If yes, is it something

How to implement multivalued attribute in Django?

匆匆过客 提交于 2019-12-11 05:26:18
问题 I have a legacy database with the following tables: person person_id (PK) | first_name | last_name 1 | John | Doe 2 | David | Bentley phonenumbers person_id (FK,PK) | phone_number (PK) | area_code (PK) 1 | 758-4551 | 909 1 | 763-3445 | 909 2 | 634-0011 | 637 Every person can have zero or more phone numbers, which is a multivalued attribute of the person entity. I've tried using the Django's inspectdb command which generated the following models.py: class Person(models.Model): person_id =

Dump all Raima db_VISTA Version 3.20 data to text

心不动则不痛 提交于 2019-12-11 02:49:58
问题 A friend has an old program that no longer works but he wants to recover the data. From the file's header I've found out that it's a legacy Raima db_VISTA Version 3.20 database. I've found this similar question How can I export data in a legacy DOS application when no export option is available?, but there's no answer that tell me how to dump the data to another format. I've tried contacting Raima, but the forums seams dead (My topic wasn't even posted by the moderator) Do you know a tool